%PUT BUILDING TABLE 6 FOR &TITLE2....;

PROC MIXED DATA=OUT.&COM NOCLPRINT; CLASS OUTLET_CD;
	MODEL LNPRICE=&RHYRS &RHS 
	OUTLET_CD/SOLUTION;
	TITLE "TABLE 2 HEDONIC INDEX";
	TITLE2 "&TITLE2";
	ODS OUTPUT SOLUTIONF=PDUMFE(DROP=DF TVALUE PROBT RENAME=(ESTIMATE=IMPFE));

DATA OUTSFE; SET PDUMFE; IF EFFECT="OUTLET_CD";
DATA MGOUT (KEEP=PERIOD OUTLET_CD STORECAT LGGROC DISCDEP--WAREHS OTHSTORE IMPFE); 
	MERGE OUT.&COM (KEEP=PERIOD OUTLET_CD STORECAT LGGROC DISCDEP--WAREHS OTHSTORE STORECAT)
  	OUTSFE;
	BY OUTLET_CD;
RUN;

PROC SORT DATA=MGOUT; BY PERIOD;
RUN;

*;
* GET MEAN EFFECTS BY STORECAT TO DECOMPOSE EFFECTS WITHIN AND WITHOUT;
*;
DATA MGOUTFL; SET MGOUT; IF PERIOD=&FIRSTPER OR PERIOD=200709;
RUN;

PROC MEANS NOPRINT DATA=MGOUTFL; BY PERIOD; CLASS STORECAT;
	VAR IMPFE; OUTPUT OUT=IMPLIST MEAN=;
	TITLE "TABLE 6. OUTLET FIXED EFFECTS BY STORE CATEGORY";
	TITLE2 "&TITLE2";
*;
PROC EXPORT DATA=IMPLIST OUTFILE=OUTCONTS
	DBMS=EXCEL REPLACE;
	SHEET=%LOOKUP(&COM);	
RUN;
